<?php
/**
 * Created By Project
 * Author: 陈东
 * Copyright：陈东
 * Source Code：陈东
 * Explain：I shall not authorize for any other commercial purposes, law breakers must be prosecuted.
 */
namespace Admin\Controller;
use Think\Controller;

class CommentController extends BaseController {

    public function index($type){
		$comment = D(C('TABLE_COMMENT'));
		$where['type'] = $type;
    	$count = $comment->where($where)->count();
    	//每页显示条数
    	$num = C('ARTICLE_NUM');
    	$page = new \Think\Page($count,$num);
    	$obj = pagestyle($page);
    	$show = $obj->show();
    	$result = $comment->where($where)->order(array('id'=>'DESC'))->limit(limitbakstr($obj))->select();
    	$this->assign('page',$show);
    	$this->assign('messagelist',$result);
		$this->display();
    }
	//删除评论
	public function delete(){
		$id = I('get.id');
		$comment = D(C('TABLE_COMMENT'));
		$res = $comment->delete($id);
		if($res){
			$this->success('删除成功');
		}else{
			$this->error('删除失败！','',1);
		}
	}


}